<h>Comprobantes adeudado</h>
<form id="frmCobrar"action="<?php echo url_for("cobro/registrarPago") ?>" method="post">
<table  width="80%" class="fuente8"  >
  <thead>
    <tr>
      <th>Cobrar</th>
      <th>Fecha emision</th>
      <th>Tipo comprobante</th>
      <th>Número</th>
      <th>Importe</th>
      <th>Mora</th>
      <th>Total</th>
        
      </tr>
  </thead>
   <tbody id="lineaResultado">
      
      <?php  $contador = 0;  $totalFactura = 0; $totalMora = 0; $totalGral = 0;
          foreach ($comprobantes as $comprobante): 
             if ($contador % 2) {
                        $fondolinea = "itemParTabla";
                    } else {
                        $fondolinea = "itemImparTabla";
                    }
                    ?>
      <tr class="<?php echo $fondolinea ?>">
           <td><input type="checkbox" id="cbx" name="cbx[]" value='<?php  echo $comprobante->getId() ?>' onClick="CalcularTotal(this,'<?php  echo $comprobante->getTotal() ?>');"    
      style="margin-left:auto; margin-right:auto;" >
<!--      <td><input type="checkbox" id="<!?php  echo $comprobante->getTotal() ?>" name="cbx[]" value='<!?php  echo $comprobante->getId() ?>' onClick="CalcularTotal(this);"    
      style="margin-left:auto; margin-right:auto;" >-->
      </td> 
      <td align="center"><?php echo $comprobante->getFechaEmision()?></td>
      <td align="center"><?php echo $comprobante->getTipoComprobante()->getNombre()   ?></td>
      <td align="center"><?php echo $comprobante->getNroComprobante() ?></td>
      <td align="right"><?php echo number_format($comprobante->getImporteFactura(),2) ?></td>
      <td align="right"><?php echo $comprobante->getMora(); ?></td>
      <td id="total<?php echo $comprobante->getId() ?>" align="right"><?php echo  number_format($comprobante->getTotal(),2,'.','') ?></td>
     </tr>
       
       <?php 
            $totalFactura += $comprobante->getImporteFactura(); 
            $totalMora += $comprobante->getMora();
            $totalGral += $comprobante->getTotal();
            $contador++; endforeach; 
         ?>
     <tr  style="font-weight: bold;">
      <td colspan="4" align="right">Totales</td>
      <td align="right"><?php echo number_format($totalFactura,2) ?></td>
      <td align="right"><?php echo number_format($totalMora,2,'.','') ?></td>
      <td align="right"><?php echo  number_format($totalGral,2,'.','') ?></td> 
         
     </tr>
  </tbody>
</table>
  
</form>